package com.vipheyue.huaxue.fragment;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.vipheyue.huaxue.R;
import com.vipheyue.huaxue.utils.DataProvider;
import com.vipheyue.huaxue.view.SimpleImageBanner;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * A simple {@link Fragment} subclass.
 */
public class BannerFragment extends Fragment {
    @Bind(R.id.sib_simple_usage)
    SimpleImageBanner sib;

    public BannerFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_banner, container, false);
        ButterKnife.bind(this, view);
        sib_simple_usage();
        return view;
    }

    private void sib_simple_usage() {

        sib
                .setSource(DataProvider.getList())
                .startScroll();

        sib.setOnItemClickL(new SimpleImageBanner.OnItemClickL() {
            @Override
            public void onItemClick(int position) {
            }
        });
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }
}
